<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>操作表单</title>
<!--    <script src="https://blog-static.cnblogs.com/files/7qin/md5.js"></script>-->
</head>
<body>
<!--
表单提交事件，
onsubmit 绑定一个提交检查的函数，true/false
将这个结果返回给表单，使用onsubmit接收
onsubmit = "return aaa()"
-->
<form action="www.baidu.com" method="post" onsubmit="return aaa()">
   <p>
       <span>用户名：</span><input id="username" type="text" name="username"/>

   </p>
    <p>
        <span>密码：</span><input id="password-input" type="password"/>
    </p>

    <input type="hidden" name="password" id="md5pwd"/>

<!--    <p>-->
<!--        <span>性别：</span>-->
<!--        <input type="radio" name="sex" id="boy" value="boy"/>男-->
<!--        <input type="radio" name="sex" id="girl" value="girl"/>女-->
<!--    </p>-->
        
    <p>
        <button type="submit">提交</button>
    </p>
</form>

<script !src="">
    "use strict";


    let boy = document.getElementById('boy');
    let girl = document.getElementById('girl');


    //查看单选框是否选中，boy.checked 是否为true
    // console.log(boy.checked);

    function aaa(){
        let username = document.getElementById('username');
        let inputPwd =  document.getElementById('password-input');
        let md5pwd = document.getElementById('md5pwd');
        alert(inputPwd.value);
        // md5pwd.value = hex_md5(inputPwd.value);
        md5pwd.value ="********";
        alert(md5pwd.value);
        return false;
    }

</script>
</body>
</html>